﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using NSpotifyLib.Interfaces;
using System.Xml.Linq;

namespace NSpotifyLib
{
    internal class TrackSearcher : BaseSearcher<Track>, IEntitySearcher<Track>
    {
        private const string searchPrefix = "search/1/track?q=";

        internal TrackSearcher(ISpotifyHTTPReader spotifyHTTPReader)
            : base(spotifyHTTPReader)
        {

        }

        public IEnumerable<Track> Search(string criteria)
        {
            document = spotifyHTTPReader.GetSpotifyData(searchPrefix + criteria);
            reader = new TrackReader(document);
            return reader.Read();
        }
    }
}
